/*
 * berton
 */
package com.pitop.t.dao;

import com.pitop.core.base.BaseDAO;
import com.pitop.t.entity.Permission;
import com.pitop.t.entity.PermissionState;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 
 *
 * @author berton
 */
@Mapper
@Repository
public  interface TpermissionDAO extends BaseDAO<Permission, Long> {


    /**
    * 根据主键permissionId,oldStates 共同更新 Permission 的状态到newState状态
    *
    * @param permissionId 
    * @param newState 新状态
    * @param oldStates 旧状态集合
    */
    void updateStateByPermissionId(@Param("permissionId") java.lang.Integer permissionId, @Param("updateTime") Date updateTime, @Param("newState") PermissionState newState, @Param("oldStates") PermissionState... oldStates);

    /**
    * 根据主键permissionId 更新 Permission 的状态到另一个状态
    *
    * @param permissionId 
    * @param state 状态
    */
    void updateByPermissionId(@Param("permissionId") java.lang.Integer permissionId, @Param("state") PermissionState state, @Param("updateTime") Date updateTime);

    /**
     * 删除对象Tpermission
     *@param params 实体的属性
     */
     void delete(Map<String, Object> params);


   /**
    * 查询Tpermission列表
    * @param rowBounds 分页参数
    * @return List<Permission>
    */
    List<Permission> list(RowBounds rowBounds);


   /**
    * 查询Tpermission分页 根据状态
    *
    * @param permissionId  
    * @return List<Permission>
    */
    List<Permission> listByPk(java.lang.Integer permissionId, PermissionState state, RowBounds rowBounds);
    int countByPk(java.lang.Integer permissionId,PermissionState state);

    List<Permission> getPermissionList(Integer userId);
}
